package cn.threecubic.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Terminator
 * @date 2021/11/5 12:29
 */
@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
        return routeLocatorBuilder.routes()
                .route("path_route_threecubic",
                        r -> r.path("/guonei")
                                .uri("https://news.baidu.com/guonei"))
                .route("path_route_threecubic2",
                        r -> r.path("/guoji")
                                .uri("https://news.baidu.com/guoji"))
                .build();
    }

}
